import { nanoid } from "nanoid"
export default function getUserTempId() {
  //定义一个user临时id，存储到localStorage中
  let userTempId = localStorage.getItem("userTempId")
  //判断如果用户没有临时id  就生成一个临时nanoid，同样存储在localStorage
  if (!userTempId) {
    userTempId = nanoid()
    localStorage.setItem("userTempId", userTempId)
  }
  //不论有没有临时id   都需要返回这个id
  return userTempId
}
